﻿<UserControl x:Class="EDMDesigner.Designer.Controls.Mapping.PropertiesMapping"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:wpfToolKit="http://schemas.microsoft.com/wpf/2008/toolkit"
    xmlns:localControlsMapping="clr-namespace:EDMDesigner.Designer.Controls.Mapping">

    <wpfToolKit:DataGrid x:Name="propertiesGrid" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type localControlsMapping:PropertiesMapping}}, Path=MappingEnumerable}">
        <wpfToolKit:DataGrid.Columns>
            <wpfToolKit:DataGridTemplateColumn Header="{x:Static localControlsMapping:PropertiesMapping.Property}">
                <wpfToolKit:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Property}" VerticalAlignment="Center" Margin="5,0" />
                    </DataTemplate>
                </wpfToolKit:DataGridTemplateColumn.CellTemplate>
            </wpfToolKit:DataGridTemplateColumn>
            <wpfToolKit:DataGridTemplateColumn Header="{x:Static localControlsMapping:PropertiesMapping.Column}">
                <wpfToolKit:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <localControlsMapping:PropertyMappingColumnComboBox Column="{Binding Column}" Table="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type localControlsMapping:TableMapping}}, Path=Table, Mode=OneTime}" />
                    </DataTemplate>
                </wpfToolKit:DataGridTemplateColumn.CellTemplate>
            </wpfToolKit:DataGridTemplateColumn>
        </wpfToolKit:DataGrid.Columns>
    </wpfToolKit:DataGrid>
</UserControl>
